package com.xiaojun.whut.util;

import java.util.HashMap;
import java.util.Map;

public class ResponseUtil {
    public static Object fail(int errNum,String errMsg){
        Map<String,Object> obj=new HashMap<>();
        obj.put("num",errNum);
        obj.put("msg",errMsg);
        return obj;
    }
    public static Object badArgument() {
        return fail(401, "参数不对");
    }
    public static Object ok(Object data){
        Map<String,Object> obj=new HashMap<>();
        obj.put("num",ResponseCode.SUCCESS);
        obj.put("msg","成功");
        obj.put("data",data);
        return obj;
    }
    public static Object ok(){
        Map<String,Object> obj=new HashMap<>();
        obj.put("num",ResponseCode.SUCCESS);
        obj.put("msg","成功");
        return obj;
    }
}
